package leetCode.hw.math;

public class HJ56Solution implements HJ56 {

    @Override
    public int calPerfectNum(int n) {
        int result = 0;
        for(int i=6;i<=n;i++) {
            int sum = 0;
            for(int j=1;j<=i/2;j++){
                if(i%j==0) sum+=j;
            }
            if(sum == i ) result ++;
        }
        return result;
    }

}
